//
//  SDTableViewCell.m
//  SuperDoctor
//
//  Created by 年浩杰 on 16/7/7.
//  Copyright © 2016年 SD. All rights reserved.
//

#import "SDAboutViewCell.h"

@interface SDAboutViewCell ()
@property (nonatomic, weak) UIImageView *iv_icon;
@property (nonatomic, weak) UIImageView *iv_addImage;
@property (nonatomic, weak) UILabel *lb_label;



@end

@implementation SDAboutViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //初始化控件
        [self setupUI];
        
        
    }
    return self;
}
#pragma mark ---------初始化控件-----------
- (void)setupUI{
#pragma mark ----------文本图标----------
    //实例化
    UIImageView *iconImage = [[UIImageView alloc] init];
    //设置图片
    iconImage.image = [UIImage imageNamed:@"product_img_icon_xieyi.png"];
    //赋值
    self.iv_icon = iconImage;
    //添加
    [self.contentView addSubview:self.iv_icon];
#pragma mark ----------箭头图标----------
    UIImageView *imageView = [[UIImageView alloc] init];
    //设置图片
    imageView.image = [UIImage imageNamed:@"product_button_input_jianjiao.png"];
    //赋值
    self.iv_addImage = imageView;
    //添加
    [self.contentView addSubview:self.iv_addImage];
#pragma mark ----------文本----------
    //实例化
    UILabel *label = [[UILabel alloc] init];
    //赋值
    label.text =@"用户协议";
    //设置字体大小
    label.font = FONT(20);
    //赋值
    self.lb_label = label;
    //添加
    [self.contentView addSubview:label];
}
#pragma mark ---------重新布局子控件-----------
- (void)layoutSubviews{
    [super layoutSubviews];
    //文本图标约束
    [self.iv_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.offset(15);
        make.centerY.mas_equalTo(self.contentView .mas_centerY);
    }];
    //箭头图标约束
    [self.iv_addImage mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.offset(-15);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        
    }];
    //文本约束
    [self.lb_label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.iv_icon.mas_right).offset(10);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
}
#pragma mark ----------重写图标set方法----------
- (void)setIconImage:(UIImage *)iconImage{
    _iconImage = iconImage;
    self.iv_icon.image = iconImage;
    
}
#pragma mark ----------重写箭头set方法----------
- (void)setIm_addImage:(UIImage *)im_addImage {
    
    _im_addImage = im_addImage;
    
    self.iv_addImage.image = im_addImage;
    
}

@end
